import net.miginfocom.swing.MigLayout

build(IpodGetActions)

def popup = popupMenu(){
    menuItem("Download", action: downloadAction)
    menuItem("Delete", action: deleteAction)
}

application(title:'ipod-get',  size:[320,480], pack:true, locationByPlatform:true) {
	menuBar(){
		menu("File"){
			menuItem("Index", action: indexAction)
		    separator()
			menuItem("Search", action: searchAction)
			menuItem("Download", action: downloadAction)
			menuItem("Delete", action: deleteAction)
			separator()
			menuItem("Exit", action: exitAction)
		}
	}
    panel(layout:new MigLayout('fill')) {
	    panel(layout:new MigLayout('fillx'), constraints: "wrap, growx") {
	    	label("Search: ")
	    	textField(id: 'searchField', columns: 20, constraints: "growx")
	    	button("Search", action: searchAction)
	    	button("Download", action: downloadAction, constraints: "wrap")
	        bean(model, searchString: bind {searchField.text} )  
	    }
	    panel(layout:new MigLayout('fill'), constraints: "grow") {
		    scrollPane(constraints: "grow"){
		    	table(id: 'searchResultTable', componentPopupMenu: popup)
		    }
	    }
    }
    

}